import { MapCoordSys, MapType } from "./myMapOpt"
export interface FeatureDataInterface {
    featureData: MapDataInterface
    featureMap: FeatureInterface
    //#region function
    /**
     * 移动到该要素
     * @param map
     */
    moveTo: (map: AMap.Map) => void

    /**
     * 添加要素，并返回地图要素
     * @param map
     * @returns {*}
     */
    addToMap: (map: AMap.Map, mapCoordSys: MapCoordSys) => any

    /**
     * 返回地图需要的数据，如果坐标不是CJ02，转换为CJ02
     * @returns {Promise<any>}
     */
    getBaiduMapOpt: (mapCoordSys: MapCoordSys,map:AMap.Map) => any

    /**
     * 更新点数据
     * @returns true;false
     */
    update: () => Promise<boolean>
    /**
     * 添加点数据
     * @returns true;false
     */
    upload: () => void

    /**
     * 返回要素的原始设置
     * @returns {Marker}
     */
    getElement: () => any

    /**
     * 判断能否正确添加到该地图
     * @returns {boolean}
     */
    isElement: () => boolean

    /**
     * 返回复制对象
     * @returns {MarkerData}
     */
    getCopy: () => any

    /**
     * 返回地图中的对象
     * @param map
     * @returns {*}
     */
    getDateInMap: (map: any) => any

    /**
     * 删除map中的元素
     * @param map
     */
    deleteDataInMap: (map: any) => void

    /**
     * 闪烁该要素
     * @param map
     */
    blinkData: (map: any) => void

    /**
     * 下载json数据
     */
    getJSON: () => void
    /**
     * 删除要素
     */
    deleteElement: () => Promise<any>

    /**
     * 设置坐标点
     * @param path 坐标点
     * @returns 
     */
    setPath:(path:any[])=>void
    //#endregion
}
export interface MapDataInterface {
    id?: string
    type?: MapType
    userinfoId?: string
    createTime?: string
    top?: boolean
    name?: string
    coordsys?: MapCoordSys
}
export interface FeatureInterface {
    id?: string
}

export class MapData implements MapDataInterface {
    id?: string
    type?: MapType
    userinfoId?: string
    createTime?: string
    top?: boolean
    name?: string
    coordsys?: MapCoordSys

    constructor({ id, type, userinfoId, createTime, top, name, coordsys }: {
        id?: string
        type?: MapType
        userinfoId?: string
        createTime?: string
        top?: boolean
        name?: string
        coordsys?: MapCoordSys
    }) {
        this.id = id
        this.type = type
        this.userinfoId = userinfoId
        this.createTime = createTime
        this.top = top
        this.name = name
        this.coordsys = coordsys || MapCoordSys.CJ02
    }
}